﻿using System.Windows.Media.Media3D;

namespace LFSRecord2.Model
{
    public class CompLayerCameraMesh : CompLayerMeshBase
    {
        public CompLayerCameraMesh()
            : base()
        {
            LayerType = CompLayerTypes.FreeCamera;

            NumPoints = 16;
            NumLineIndexes = 40;

            // Set body points
            Points = new Point3D[NumPoints];
            Points[0] = new Point3D(-6.5, -9, -6.5);
            Points[1] = new Point3D(-6.5, 9, -6.5);
            Points[2] = new Point3D(6.5, 9, -6.5);
            Points[3] = new Point3D(6.5, -9, -6.5);

            Points[4] = new Point3D(-6.5, -9, 6.5);
            Points[5] = new Point3D(-6.5, 9, 6.5);
            Points[6] = new Point3D(6.5, 9, 6.5);
            Points[7] = new Point3D(6.5, -9, 6.5);

            // The lense points
            Points[8] = new Point3D(-2, 9, -2);
            Points[9] = new Point3D(2, 9, -2);
            Points[10] = new Point3D(2, 9, 2);
            Points[11] = new Point3D(-2, 9, 2);

            Points[12] = new Point3D(-5.5, 16.5, -5.5);
            Points[13] = new Point3D(5.5, 16.5, -5.5);
            Points[14] = new Point3D(5.5, 16.5, 5.5);
            Points[15] = new Point3D(-5.5, 16.5, 5.5);


            // Set body lines
            LineIndexes = new int[NumLineIndexes];
            LineIndexes[0] = 0; LineIndexes[1] = 1;
            LineIndexes[2] = 1; LineIndexes[3] = 2;
            LineIndexes[4] = 2; LineIndexes[5] = 3;
            LineIndexes[6] = 3; LineIndexes[7] = 0;

            LineIndexes[8] = 4; LineIndexes[9] = 5;
            LineIndexes[10] = 5; LineIndexes[11] = 6;
            LineIndexes[12] = 6; LineIndexes[13] = 7;
            LineIndexes[14] = 7; LineIndexes[15] = 4;

            LineIndexes[16] = 0; LineIndexes[17] = 4;
            LineIndexes[18] = 1; LineIndexes[19] = 5;
            LineIndexes[20] = 2; LineIndexes[21] = 6;
            LineIndexes[22] = 3; LineIndexes[23] = 7;

            // Set lense lines
            LineIndexes[24] = 8; LineIndexes[25] = 12;
            LineIndexes[26] = 9; LineIndexes[27] = 13;
            LineIndexes[28] = 10; LineIndexes[29] = 14;
            LineIndexes[30] = 11; LineIndexes[31] = 15;

            LineIndexes[32] = 12; LineIndexes[33] = 13;
            LineIndexes[34] = 13; LineIndexes[35] = 14;
            LineIndexes[36] = 14; LineIndexes[37] = 15;
            LineIndexes[38] = 15; LineIndexes[39] = 12;
        }
    }
}
